﻿import flash.display.BitmapData;
import kliment.display.MCC;
import kliment.display.loader.ImageLoader;

/**
 * ...
 * @author	Kliment
 * @version	2.1.0
 */
class kliment.display.Printer extends PrintJob {
	
	public function Printer() {
		super();	
	}
	
	public function addPhotoPage(target_mc:MovieClip, crop:Boolean,  centred:Boolean):Void {
		var xscale:Number = target_mc._xscale;
		var yscale:Number = target_mc._yscale;
		var x:Number = target_mc._x;
		var y:Number = target_mc._y;
		target_mc._xscale = 100;
		target_mc._yscale = 100;
		target_mc._x = 0;
		target_mc._y = 0;
		
		var srcImage:BitmapData = new BitmapData(target_mc._width, target_mc._height, true, 0xffffff);			
		srcImage.draw(target_mc);
		target_mc._xscale = xscale;
		target_mc._yscale = yscale;
		target_mc._x = x;
		target_mc._y = y;
		
		var img:BitmapData = ImageLoader.resizeBitmap(srcImage, pageWidth, pageHeight, crop, centred, true);
		
		var temp_mc:MovieClip = MCC.create();
		temp_mc._visible = false;
		MCC.attachBitmap(temp_mc, img);
		addPage(temp_mc);
		MCC.remove(temp_mc);
	}
}